package quick.frame.core.ui.dialog;


import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;

public class DialogUtil {
	
	public static void showMsgDialog(final Context ctx, String title, String msg){
		
		Builder builder = new Builder(ctx);

		builder.setMessage(msg);
		builder.setTitle(title);

		builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {

				dialog.dismiss();
			}
		});
		builder.create().show();
	}

	public static void showMsg(final Context ctx, String title, String msg, DialogInterface.OnClickListener listener) {
		Builder builder = new Builder(ctx);

		builder.setMessage(msg);
		builder.setTitle(title);

		builder.setPositiveButton("确认", listener);
		builder.create().show();

	}

	public static void showMsgDialog(final Context ctx, String title, String msg, final OnClickEvent clickEvent){

		Builder builder = new Builder(ctx);

		builder.setMessage(msg);
		builder.setTitle(title);

		builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				clickEvent.onClick(dialog,which);
				dialog.dismiss();
			}
		});
		builder.create().show();
	}
	public interface OnClickEvent{
		void onClick(DialogInterface dialog, int which);
	}
}
